<style lang="scss" scoped>
.qr-logon{width: 300px; height: 300px;}
</style>

<template>

    <section>
        <h1>aaaaaaa</h1>
        <h1>{{a}}{{a}}{{a}}{{a}}{{a}}</h1>
        <h1>aaaaaaaa</h1>

        <div id="qr-login" class="qr-login"></div>

    </section>

</template>

<script>

import com from 'js/common'
import qs from 'qs'

console.log(com.createJs)

var qrBoxDom;

var wxLoginJs = 'http://res.wx.qq.com/connect/zh_CN/htmledition/js/wxLogin.js';
function wxLoginJsFn(){
    var obj = new WxLogin({
        id:"qr-login",
        appid: "wxf0b4fc574bb67f30",
        scope: "snsapi_login",
        redirect_uri: "http%3A%2F%2Ffesass.jinghao.com%2Fcom%2Fmember%2FwxLoginCall",
        state: "",
        style: "black",
        href: ""
    });
}
function wxLogin(){
    com.createJs(wxLoginJs, wxLoginJsFn)
}

export default{
    data: function(){
        return {
            qrUrl: '',

            a: 3
        }
    },
    mixins: [mixinMethods],
    methods: {

    },
    mounted: function(){
        var self = this;

        axios.post('/com/member/getLoginConfig', qs.stringify({})).then( (res) =>{

        });

        var urlCode = this.$route.query.code;
        if(urlCode){
            axios.get('https://api.weixin.qq.com/sns/oauth2/access_token', {params: {
                appid: 'wxf0b4fc574bb67f30',
                secret: '',
                code: urlCode,
                grant_type: ''
            }}).then( (res) =>{
                // do it
            });

        }

//        axios.post('/xxx', qs.stringify({})).then( (res) => {
//            var d = res.data;
//            if(d.flag == 1){
//            }
//        } )

        wxLogin();

        axios.post('/com/exam/getLibList', qs.stringify({
            page: 1,
            pagesize: 20
        })).then( (res) =>{


            var d = res.data;
            if(d.flag == 1){
                console.log(d.flag);
                console.log(d)
                this.a = d.data.Total
            }

        });


function alert_loaded() {
    //alert("XDR onload");
    //alert("Got: " + xdr.responseText);
    console.log('xxxx')
    console.log(("Got: " + xdr.responseText));
}

var xdr;
if(window.XDomainRequest){
    xdr = new XDomainRequest(); // Create a new XDR object.

    if (xdr){

     xdr.onload      = alert_loaded;

     xdr.open("get", 'http://apitest-sass.jinghao.com/com/exam/getLibList');

     xdr.send();
     }
}


    }
}


</script>